package util;



import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import json.Result;
import json.TSchool;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.springframework.context.ApplicationContext;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.sun.corba.se.impl.copyobject.JavaStreamObjectCopierImpl;

import po.School;
import po.Score;
import po.Subject;
import po.Teacher;
import po.WangdianType;
import po.WangdianZuobiao;

import dao.SchoolDao;
import dao.SchoolIbatisDao;




public class BeanToJson {
		public static void main(String args[]) throws Exception{
			//BeanToJson.class.getClassLoader().getResourceAsStream("config/application.xml");
			ApplicationContext  applicationContext = new ClassPathXmlApplicationContext("applicationIbatis.xml");  
 
			SchoolIbatisDao dao=(SchoolIbatisDao)applicationContext.getBean("SchoolIbatisDao");  
//			Result a=new Result();
//		List<School> result= dao.getSchools();
////		List<Score> Score= dao.getScore();
////		List<Teacher> Teacher= dao.getTeacher();		
////		List<Subject> Subject= dao.getSubject();
//		
//		for(School o:result){
//			o.setTeachers(dao.getTeacher(o.getSid().toString()));
//			o.setScores(dao.getScore(o.getSid().toString()));
//			o.setSubjects(dao.getSubject(o.getSid().toString()));
//		}
//		
//		
//		
//		List<TSchool> list=new ArrayList<TSchool>();
//		for(School c:result)
//			list.add(new TSchool(c));
//		
//		a.getResponse().setSchools(list);
//		
//		JSONObject o=JSONObject.fromObject(a);
//		List<WangdianZuobiao> list=	dao.getWangDian();
//		//System.out.println(dao.getWangDian().size());
//		
//		JSONArray o=JSONArray.fromObject(list);
			
			List<WangdianType> list=	dao.getWangDianType();
			for(WangdianType a :list){
				System.out.println("<option value='"+a.getType()+"'>"+a.getName()+"</option>");
			}
			
		//System.out.println(o.toString());
	
			
			
		}
	
//		 public List<Student> findAllStudent() throws SQLException {  
//		      getSqlMapClient().queryForList("findAllStudent");  
//		        System.out.println(result);  
//		        return result;  
//		    }  
}
